package cn.lanqiao.jh;

import java.util.TreeSet;

public class Test {
    public static void main(String[] args) {
        TreeSet hashSet = new TreeSet((Object o1, Object o2) -> ((Student) o1).getStuName().compareTo(((Student) o2).getStuName()));
        hashSet.add(new Student(101, "ccc")); // int -> Integer -> Object
        hashSet.add(new Student(102, "aaa"));
        hashSet.add(new Student(103, "bbb"));
        hashSet.add(new Student(101, "david"));

        hashSet.forEach(System.out::println);

//        for (Object o : hashSet) {
//            System.out.println(o.toString());
//        }

//        System.out.println("Aa".hashCode());
//        System.out.println("BB".hashCode());
//        ArrayList<Student> arrayList = new ArrayList<>();
//        arrayList.add(new Student(102,"bbb"));
//        arrayList.add(new Student(101,"ccc"));
//        arrayList.add(new Student(104,"aaa"));
//        arrayList.add(new Student(103,"ddd"));
//
//
//        Collections.sort(arrayList,new StudentComparator());
//
//        for (int i = 0; i < arrayList.size(); i++) {
//            System.out.println(arrayList.get(i));
//        }


    }
}
